// constants/codes.go
package constants

const DefaultPassword = "12345678"

// 业务状态码
const (
	LoginSuccess       = 0
	LoginUserNotFound  = 10001
	LoginPasswordError = 10002
	LoginUserDisabled  = 10003
	LoginParamError    = 10004
	LoginAuthFailed    = 10005
	LoginSessionLimit  = 10006
	LoginOrgNotFound   = 10007
	LoginServerError   = 50000
)

// 状态码对应的消息映射
var LoginMessages = map[int]string{
	LoginSuccess:       "登录成功",
	LoginUserNotFound:  "用户不存在",
	LoginPasswordError: "用户名或密码错误",
	LoginUserDisabled:  "账号已被禁用或锁定",
	LoginParamError:    "请求参数错误",
	LoginAuthFailed:    "认证失败",
	LoginSessionLimit:  "会话数量超限",
	LoginOrgNotFound:   "所属单位未找到",
	LoginServerError:   "系统错误，请稍后重试",
}

// 获取状态码对应的消息
func GetLoginMessage(code int) string {
	if msg, exists := LoginMessages[code]; exists {
		return msg
	}
	return "未知错误"
}

// 支持自定义消息
func GetLoginMessageWithDefault(code int, defaultMsg string) string {
	if msg, exists := LoginMessages[code]; exists {
		return msg
	}
	return defaultMsg
}
